package com.theyeasy.dvmini.pc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.theyeasy.dvmini.pc.controller.BaseController;
import com.theyeasy.dvmini.service.ChatLogService;
import com.theyeasy.dvmini.service.FansService;
import com.theyeasy.dvmini.service.PosterService;
import com.theyeasy.dvmini.service.RemarksService;
import com.theyeasy.dvmini.service.SalesService;
import com.theyeasy.dvmini.vo.Vo_msg;

@Controller
@RequestMapping("/report")
public class ReportController extends BaseController {

	@Autowired
	ChatLogService chatlogService;

	@Autowired
	FansService fansService;

	@Autowired
	PosterService posterService;
	
	@Autowired
	SalesService saleService;
	
	@Autowired
	RemarksService remarkService;

	@RequestMapping("/chatrecord")
	public ModelAndView chatrecord() {
		ModelAndView mv = new ModelAndView("/pc/report/chatrecord");
		return mv;
	}
	@RequestMapping("/chatlog")
	public ModelAndView chatlog() {
		ModelAndView mv = new ModelAndView("/pc/report/chatlog");
		return mv;
	}

	@RequestMapping("/fans")
	public ModelAndView fans() {
		ModelAndView mv = new ModelAndView("/pc/report/fans");
		return mv;
	}

	@RequestMapping("/posterrecord")
	public ModelAndView posterrecord() {
		ModelAndView mv = new ModelAndView("/pc/report/posterrecord");
		return mv;
	}

	@RequestMapping("/salereport")
	public ModelAndView salereport() {
		ModelAndView mv = new ModelAndView("/pc/report/salereport");
		return mv;
	}

	@RequestMapping("/callreport")
	public ModelAndView wanxereport() {
		ModelAndView mv = new ModelAndView("/pc/report/callreport");
		return mv;
	}
	
	@RequestMapping("/remarksreport")
    public ModelAndView remarksreport() {
        ModelAndView mv = new ModelAndView("/pc/report/remarksreport");
        return mv;
    }
	@RequestMapping("/winningrecord")
    public ModelAndView winningrecord() {
        ModelAndView mv = new ModelAndView("/pc/report/winningrecord");
        return mv;
    }
	
	
	// 聊天记录列表
	@RequestMapping(value = "/getChatLogList")
	@ResponseBody
	public Object getChatLogList(Integer page, Integer replytype, String date1, String date2, String keyword) {

		return new Vo_msg(0, chatlogService.getChatLogList(page, replytype, date1, date2, keyword));
	}

	// 粉丝记录
	@RequestMapping(value = "/getFansList")
	@ResponseBody
	public Object getFansList(Integer page, String keyword) {

		return new Vo_msg(0, fansService.getFansList(page, keyword));
	}

	// 海报记录
	@RequestMapping(value = "/getPosterLog")
	@ResponseBody
	public Object getPosterLog(Integer page, String keyword, Integer postertype) {

		return new Vo_msg(0, posterService.getPosterLog(page, keyword, postertype));

	}
	
	// 电话拨打记录
    @RequestMapping(value = "/getCalllogList")
    @ResponseBody
    public Object getCalllogList(Integer page, String keyword) {

        return new Vo_msg(0, fansService.getCalllogList(page, keyword));

    }
    
  //销售报表
    @RequestMapping(value = "/getSalesReportList")
    @ResponseBody
    public Object getSalesReportList(Integer page, String keyword) {

        return new Vo_msg(0,saleService.getSalesReportList(page, keyword));

    }
    
    
    //查询楼盘的评论信息
    @RequestMapping(value = "/getRemarksList", method = RequestMethod.POST)
    public @ResponseBody Object getRemarksList(Integer page, Integer pagesize,Integer estateid) {
     return new Vo_msg(0,remarkService.getRemarksList(page, pagesize, estateid, ""));    
    }
}